{% extends "base.html" %}
{% block header %}

<script type="text/javascript">
function setsmall(){
    $('.host img').width(33);
}

function setbig(){
    $('.host img').width(100);
}
</script>
{% endblock %}

{% block content %}
        <h3 class='tit' style="margin-top:0px">服务稳定性汇总 
            <span><a href='javaScript:setsmall()'>小图标</a> | 
            <a href='javaScript:setbig()'>大图标</a></span> </h3>
        <div class="listhost">
            {% for h in hosts %}
                <div class='host'>
                <a href="/monitor/monitorlist?id={{h.id}}">
                {% if h.stat == '1' %}
                    <img src="/static/image/run.gif" alt=""  style="width:33px" />
                {% else %}
                    <img src="/static/image/down.gif" alt="" style="width:33px" />
                {% endif %}
                </a>
                </div>
            {% endfor %}
        </div>

    <div class="clr"></div>
      <h3 class="tit">故障历史汇总</h3>

        <div  class="flow-dis">

	    <div class="title">
	        <span style="width:15%">最后报警时间</span>
	        <span style="width:25%">监控名称</span>
	        <span style="width:20%">主机名称</span>
	        <span style="width:10%">持续时间</span>
	        <span style="width:10%">报警次数</span>
	        <span style="width:7%">目前状态</span>
	        <span style="width:8%">故障原因</span>
	    </div>
	  {% for alt in  uniqAlert %}
	    <div class="{% cycle 'ji' 'ou' %}">
	        <span style="width:15%">{{ alt.timestamp|date:"Y-m-d H:i:s" }}</span>
	        <span style="width:25%">{{ alt.mid.mname }}</span>
	        <span style="width:25%">{{ alt.mid.hid }}</span>
	        <span style="width:10%">{{ alt.downtime }}s</span>
            {% if alt.num < 5 %}
	        <span style="width:10%">{{ alt.num }}</span>
            {% else %}
	        <span style="width:10%"><font color='red'>{{ alt.num }}</font></span>
            {% endif %}
	        <span style="width:7%">{{ alt.mid.status }}</span>
	        <span style="width:8%"> 
	            {% if alt.reason %}
	            <a href='/alert/reason/{{ alt.id }}'>查看</a>
	            {% else %}
	            <a href='/alert/replay/{{ alt.id }}'>回复</a>
	            {% endif %}
	        </span>
	    </div>
	{% endfor %}
        </div>


{% endblock %}
